export default {
  namespaced: true,
  state: {
    goodsList: []
  },
  mutations: {
    /**
     * 添加商品
     * @param state
     * @param goodsList 商品列表
     */
    addGoods(state, goodsList) {
      state.goodsList = goodsList;
    },
    /**
     * 删除已选择的商品
     * @param state
     * @param goodsId 商品id
     */
    deleteGoods(state, goodsId) {
      state.goodsList = state.goodsList.filter(item => item.id !== goodsId);
    },
    clearGoods(state) {
      state.goodsList = []
    }
  },
  getters: {

  }
}